# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
#     https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
#     https://docs.fastlane.tools/plugins/available-plugins
#

# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane

default_platform(:ios)

  platform :ios do
    desc "Description of what the lane does"
    lane :beta do
      # https://docs.travis-ci.com/user/common-build-problems/#fastlane
    create_keychain(
      name: ENV["MATCH_KEYCHAIN_NAME"],
      password: ENV["MATCH_PASSWORD"],
      default_keychain: true,
      unlock: true,
      timeout: 3600,
      add_to_search_list: true
    )

    match(
      type: "appstore",
      keychain_name: ENV["MATCH_KEYCHAIN_NAME"],
      keychain_password: ENV["MATCH_PASSWORD"],
      readonly: true
    )

  build_app(workspace: "Runner.xcworkspace", scheme: "Runner")

  if ENV["FASTLANE_SKIP_UPLOAD"] == "true"
    puts "Skipping fastlane upload."
    next
  end

  upload_to_testflight
  end
end
